//---------------------------------------------------------------------------

#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <ComCtrls.hpp>
#include <Menus.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
    TButton *Button1;
    TButton *Button2;
    TButton *Button3;
    TButton *Button4;
    TLabel *Label1;
    TLabel *Label2;
    TLabel *Label3;
    TLabel *Label4;
    TEdit *reads;
    TEdit *writes;
    TEdit *rfails;
    TEdit *wfails;
    TEdit *current;
    TLabel *Label5;
    TEdit *readb;
    TPaintBox *pb1;
    TEdit *ptr;
    TListView *deblog;
    TLabel *Label6;
    TEdit *cached;
    TEdit *cacheblocks;
    TPopupMenu *pop;
    TButton *Button5;
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall Button1Click(TObject *Sender);
    void __fastcall Button2Click(TObject *Sender);
    void __fastcall Button4Click(TObject *Sender);
    void __fastcall Button3Click(TObject *Sender);
    void __fastcall Button5Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
    __fastcall TForm1(TComponent* Owner);
};

BOOL __stdcall OnFormat(IN HANDLE hDisk, IN DWORD Progress, IN PVOID Context);
unsigned long nread(unsigned long buf, unsigned long offset, unsigned long size, bool paged);
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;

typedef struct
{
    ULONG offset;
    ULONG len;
    LPVOID buf;
    ULONG changed;
    bool unsaved;
    DWORD opid;
} CACHE;
unsigned long nwrite(unsigned long buf, unsigned long offset, unsigned long size, bool paged, bool cachesave);
DWORD __stdcall OnRead(IN HANDLE hDisk, IN PVOID Context, IN PVOID Buffer, IN ULONG Length,
    IN LARGE_INTEGER ByteOffset, IN BOOL PagingIo, OUT PULONG BytesRead);
    void paintdisk(int what, LARGE_INTEGER off, ULONG len, bool paging );
//---------------------------------------------------------------------------
#endif
